<template>
  <div class="house-item">
    <div class="item-inner">
      <div class="cover">
        <img :src="itemData.image.url" alt="" />
      </div>
      <div class="infos">
        <div class="location">
          <img src="@/assets/img/home/location.png" alt="" />
          <div class="text">{{ itemData.location }}</div>
        </div>
        <div class="name">{{ itemData.houseName }}</div>
        <div class="summary">{{ itemData.summaryText }}</div>
        <div class="price">
          <div class="new">{{ "¥" + itemData.finalPrice }}</div>
          <div class="old">{{ "¥" + itemData.productPrice }}</div>
          <div class="tip">{{ itemData?.priceTipBadge?.text }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
defineProps({
  itemData: {
    type: Object,
    default: () => ({}),
  },
});
</script>

<style lang="less" scoped>
.house-item {
  width: 50%;
  .item-inner {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    margin: 5px;
    background-color: #fff;

    .cover {
      img {
        width: 100%;
        height: 113px;
      }
    }

    .infos {
      padding: 8px 10px;
      color: #666;
      font-size: 12px;

      .location {
        display: flex;
        align-items: center;

        img {
          width: 12px;
          height: 12px;
        }

        .text {
          margin-left: 3px;
          font-size: 12px;
        }
      }

      .name {
        font-size: 14px;
        text-overflow: ellipsis;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        display: -webkit-box;

        margin: 8px 0;
        color: #333;
      }

      .price {
        display: flex;
        justify-content: flex-start;
        margin: 8px 0;

        .new {
          color: var(--primary-color);
          font-size: 14px;
        }

        .old {
          color: #999;
          text-decoration: line-through;
          margin: 0 3px;
        }

        .tip {
          background-image: linear-gradient(270deg, #f66, #ff9f9f);
          color: #fff;
          padding: 0 6px;
          border-radius: 8px;
        }
      }
    }
  }
}
</style>
